package vip.finance.makemoney.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import vip.finance.makemoney.entity.Stock;
import vip.finance.makemoney.entity.UserStock;

import java.util.List;

/**
 * <p>
 * 自选股 Mapper 接口
 * </p>
 *
 * @author yangbin
 * @since 2023-02-03
 */
@Mapper
public interface UserStockMapper extends BaseMapper<UserStock> {
    //说了很多次了，key中使用SpEL表达式，即可用字段名，也可以用a0/p0这种按照顺序的方式去获取
    @Cacheable(value = "cache:userStocks", key = "#a0")
    List<Stock> selectUserStocks(@Param("userId") Integer userId);
}
